package lk.icta.common.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;

/**
 * @author Kusal Samarakoon
 */
@Entity
@Table(schema = "COMMON_RAIL")
@NamedQueries({
        @NamedQuery(
                name = "findRailwayProtectionZone",
                query = "SELECT p FROM RailwayProtectionZone p"
        ),
        @NamedQuery(
                name = "getAllRailwayProtectionZonesByUserLanguage",
                query = "SELECT p FROM RailwayProtectionZone p"
        )
})
public class RailwayProtectionZone implements Serializable {
    /**
     * A system generated unique key
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int id;

    @Column(updatable = false, unique = true, nullable = false)
    private int codeNo;

    @Column(nullable = false, unique = true, updatable = false)
    private String siProtectionZoneName;
    @Column(nullable = false, unique = true, updatable = false)
    private String enProtectionZoneName;
    @Column(nullable = false, unique = true, updatable = false)
    private String taProtectionZoneName;

//    @Column(columnDefinition = "smallint not null default 1")
//    private boolean active;

    @ManyToMany(fetch = FetchType.EAGER)
    @JoinTable(schema = "COMMON_RAIL")
    private List<RailwayTrack> railwayTrack;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getCodeNo() {
        return codeNo;
    }

    public void setCodeNo(int codeNo) {
        this.codeNo = codeNo;
    }

    //    public boolean isActive() {
//        return active;
//    }
//
//    public void setActive(boolean active) {
//        this.active = active;
//    }

    public String getSiProtectionZoneName() {
        return siProtectionZoneName;
    }

    public void setSiProtectionZoneName(String siProtectionZoneName) {
        this.siProtectionZoneName = siProtectionZoneName;
    }

    public String getEnProtectionZoneName() {
        return enProtectionZoneName;
    }

    public void setEnProtectionZoneName(String enProtectionZoneName) {
        this.enProtectionZoneName = enProtectionZoneName;
    }

    public String getTaProtectionZoneName() {
        return taProtectionZoneName;
    }

    public void setTaProtectionZoneName(String taProtectionZoneName) {
        this.taProtectionZoneName = taProtectionZoneName;
    }

    public List<RailwayTrack> getRailwayTrack() {
        return railwayTrack;
    }

    public void setRailwayTrack(List<RailwayTrack> railwayTrack) {
        this.railwayTrack = railwayTrack;
    }
}